package com.gbb.simple.ui.toggle;

import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;

import com.gbb.common.tools.FragmentHelper;
import com.gbb.simple.R;
import com.gbb.simple.base.BaseFragmentActivity;

/**
 * @author gaobingbing
 */
public class ToggleFragmentActivity extends BaseFragmentActivity implements OnClickListener {

    private FragmentHelper fragmentHelper;

    private ToggleFragment toggleFragment;

    @Override
    protected void onCreate(Bundle savedInstanceState){
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_toggle_fragment);

        toggleFragment = new ToggleFragment();
        fragmentHelper = FragmentHelper.getNewInstance(getSupportFragmentManager());
        fragmentHelper.addFragmentToStack(R.id.fragment_container,toggleFragment,true);

        findViewById(R.id.btn_fragment).setOnClickListener(this);
    }

    @Override
    public void onClick(View v){
        fragmentHelper.toggleFragment(toggleFragment);
    }

}
